Computer Science

Data Representation

Bit

  • Computers use binary – the digits 0 and 1 – to store data. A binary digit, or bit, is the smallest unit of data in computing. It is represented by a 0 or a 1.

Byte

  • A group of 8 bits is called a byte.
  • 1000 bytes = 1 kilobyte
  • 1,000,000 bytes = 1 megabyte
  • 1,000,000,000 bytes = 1 gigabyte

Binary

  • Computers use binary – the digits 0 and 1 – to store data. Because it only has 2 symbols (0 & 1) it is also called BASE-2 numbering. Binary also refers to the format in which numbers are transmitted and calculated in a computer system.

Denary

  • Denary is a numbering system with 10 symbols: 0123456789 It is, therefore, often referred to as BASE-10 numbering

Hexadecimal

  • Hexadecimal is a numbering system with 16 symbols. It is, therefore, often referred to as BASE-16 numbering. Hex, as it is often called, is used to represent very large numbers quickly, such as those used in color representation.

Converting

Table: 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1

Binary to denary

  • First, draw the table
  • Add the numbers corresponding to the position where 1 is present

Denary to binary

  • First, draw the table until the headers surpass the denary digit's value
  • If the denary value is larger than the header (beginning from left to right), subtract the value of the header from the denary value, then continue the process until denary value becomes 0.

Binary to Hexadecimal

  • Order of Hexadecimal: 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
  • Group the hexadecimal value in 4's, where each group maximum possible value is F
  • After grouping the binary digit and converting each group into the hexadecimal equivalent, write the complete hexadecimal by grouping the groups' value

Hexadecimal to binary

  • Simply convert each hexadecimal value into binary digits by using the hexadecimal values: 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Hexadecimal to denary

  • Convert hexadecimal to binary, then binary to denary

Data representation

Character Sets

  • Collection of characters that can be represented in binary

ASCII

  • can represent "English"/western characters, only uses 8 bits to represent characters; smaller file size than Unicode
  • Uses up to 8 bits per character; Is less inclusive than Unicode

Unicode

  • can represent all characters (other languages, emojis), and uses 16 bits to represent characters; larger file size than ASCII
  • Uses up to 16 bits per character
  • Is more inclusive than ASCII, but as due to increased number of bits, it has a larger file size than ASCII

Exam Tip

This is a typical question the IB asks: "What are the differences/advantages/disadvantages between ASCII and UNICODE?"

Images

Bitmap

  • Made up of pixels
  • Each pixel is represented by a binary number

Pixel

  • Smallest unit of image with a unique color

Color Depth

  • Number of bits used to represent the colors

Resolution

  • Total number of pixels in a bitmap